<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>05 demo2</title>
</head>

<body>
    <h1>select事件</h1>
    <p>选中文本，并检查控制台输出</p>

    <input id="test" type="text" value="Select me!">

    <script>
        var elem = document.getElementById('test');
        elem.addEventListener('select', function (e) {
            console.log("e.type:", e.type); // "select"
            console.log("e.target.value:", e.target.value);
        }, false);
    </script>

</body>

</html>